<?php

/**
 * Node Categories Model
 *
 */
class Application_Model_NodeCategories
{
    
    /**
     * Returns an array with valid node categories
     *
     * first one is default
     * 
     * @return array
     */
    static function getValidCategories()
    {
        return Zend_Registry::get('config')->nodeCategories->toArray();
    }
    
    /**
     * Returns default node category
     *
     * @return string
     */
    static function getDefaultCategory()
    {
        $cats=self::getValidCategories();
        
        return $cats[0];
    }
    
    /**
     * Checks if given category is valid
     *
     * @param string $cat
     * @return bool
     */
    static function isValidCategory($cat)
    {
        if (empty($cat)) return false;
        
        $cats=self::getValidCategories();
        
        return in_array($cat,$cats) ? true : false;
    }
    
    /**
     * Returns node category human name
     *
     * @param string $category
     * @return string
     */
    static function getCategory($category)
    {
        return Zend_Registry::get('locale')->_('node:category:'.$category);
    }
}

